Skip to content

Conversation

guptadev21
Copy link
Member

✨ What’s new in this PR

  • 🆕 Added Pydantic models for SDK resources (like Packages, Deployments, Disks, etc.)
  • 🔄 Switched out the old JSONSchema validation for shiny new Pydantic validation
  • 📦 Any manifest you apply or fetch via API now gets checked against these models
  • 🛠️ Validation errors are now crystal clear, showing the exact field + reason (no more cryptic JSONSchema errors 🙌)

💡 Why this matters

  • JSONSchema errors = 😵‍💫 confusing & painful
  • Pydantic errors = 🪄 clean, human-readable, and developer-friendly
  • Makes SDK code easier to maintain + fewer “mystery bugs” slipping into production 🎯

resolves https://github.com/rapyuta-robotics/rapyuta_io/issues/922

@guptadev21 guptadev21 self-assigned this Sep 1, 2025
@guptadev21 guptadev21 requested review from a team as code owners September 1, 2025 12:07
@guptadev21 guptadev21 requested review from ankitrgadiya, sharmayajush and amitsingh21 and removed request for a team and sharmayajush September 1, 2025 12:07
@guptadev21 guptadev21 force-pushed the feat/manifest-validation branch 7 times, most recently from 45143e6 to c186df2 Compare September 4, 2025 10:37
@guptadev21 guptadev21 force-pushed the feat/manifest-validation branch 2 times, most recently from f5794b6 to 0f1d84e Compare September 23, 2025 10:48
…work, Organization, Package, Project, Secret, StaticRoute, and User
…e response validation

- Updated network tests to utilize Network and NetworkList models, enhancing response validation.
- Refactored organization tests to use Organization model for better structure and clarity.
- Modified package tests to implement Package and PackageList models, ensuring accurate response checks.
- Revised project tests to leverage Project and ProjectList models for improved data handling.
- Enhanced secret tests to utilize Secret and SecretList models, streamlining response validation.
- Updated static route tests to incorporate StaticRoute and StaticRouteList models for better consistency.
- Refactored user tests to use appropriate Pydantic models, improving clarity and response validation.
@guptadev21 guptadev21 force-pushed the feat/manifest-validation branch from 0f1d84e to 889383f Compare September 25, 2025 04:19
@guptadev21 guptadev21 requested a review from Copilot September 25, 2025 04:27
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces comprehensive Pydantic model validation for SDK resources to replace the old JSONSchema validation, improving error messaging and maintainability.

Key Changes

  • Replaced Munch objects with strongly typed Pydantic models for all API responses
  • Migrated from JSONSchema to Pydantic validation for manifest/resource validation
  • Updated test suite to use proper mock data fixtures and structured assertion patterns

Reviewed Changes

Copilot reviewed 49 out of 50 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
rapyuta_io_sdk_v2/client.py Added Pydantic model validation for all API methods and updated return types
rapyuta_io_sdk_v2/utils.py Removed handle_and_munchify_response decorator and munch dependencies
rapyuta_io_sdk_v2/pydantic_models/ New comprehensive Pydantic models for all resource types
tests/sync_tests/ Updated test files to use Pydantic model fixtures and structured assertions
tests/async_tests/ Updated async test files with similar validation and fixture improvements
tests/data/mock_data.py Significantly expanded mock data with proper Pydantic model fixtures
Comments suppressed due to low confidence (1)

tests/sync_tests/test_managedservice.py:1

  • Duplicate function definitions detected. The test_create_instance_binding_success function appears twice with identical logic (lines 167-188 and 217-225), which suggests a copy-paste error during refactoring.
import httpx

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@guptadev21 guptadev21 force-pushed the feat/manifest-validation branch from 1f9e28d to 9af30e9 Compare September 29, 2025 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants